package com.bdqn.Test;

import com.bdqn.Sj2.*;

import java.util.Scanner;

public class Sj2 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.print("请输入操作符:");
        String fu=in.next();
        System.out.print("请输入第一个数:");
        double num1=in.nextDouble();
        System.out.print("请输入第二个数:");
        double num2=in.nextDouble();
        Technology technology=null;
        switch (fu){
            case "+":
                technology=new AddFactory();
                break;
            case "-":
                technology=new SubtractFactory();
                break;
            case "*":
                technology=new MulFactory();
                break;
            case "/":
                technology=new ExceptFactory();
                break;
        }
        Operation operation=technology.createOperation();
        operation.setNumberA(num1);
        operation.setNumberB(num2);
        System.out.println(operation.Result());

    }
}
